home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / xdme_1.84_src.lha / XDME / Util / Var / y.tab.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-22  |  26.1 KB  |  1,052 lines

  1.  
  2. /*  A Bison parser, made from yacc.y with Bison version GNU Bison version 1.22
  3.   */
  4.  
  5. #define YYBISON 1  /* Identify Bison output.  */
  6.  
  7. #define    RBRA    258
  8. #define    EBRA    259
  9. #define    RKET    260
  10. #define    EKET    261
  11. #define    ASS    262
  12. #define    SEMI    263
  13. #define    ADD    264
  14. #define    SBRA    265
  15. #define    SKET    266
  16. #define    SSBRA    267
  17. #define    SSKET    268
  18. #define    KOMMA    269
  19. #define    PROJECT    270
  20. #define    GLOBAL    271
  21. #define    CONST    272
  22. #define    HIDDEN    273
  23. #define    INTERNAL    274
  24. #define    GENERIC    275
  25. #define    TEMPORARY    276
  26. #define    TYPES    277
  27. #define    NEEDED    278
  28. #define    GENTYPE    279
  29. #define    DEFAULT    280
  30. #define    HELP    281
  31. #define    LABEL    282
  32. #define    VALUE    283
  33. #define    NEWFILE    284
  34. #define    BLOCKSTART    285
  35.  
  36. #line 4 "yacc.y"
  37.  
  38. /* Achtung, dieser Parser vergeudet speicher in rauhen megen ...*/
  39.     /* 25-09-94 * rewritten */
  40.     /* 30-09-94 * shortened */
  41.  
  42.  
  43.  
  44. /*
  45.     > BISON -y -d Yacc.y
  46.     > Dcc y.tab.c -mD -c
  47. */
  48.  
  49.  
  50. #include <assert.h>
  51. #include <string.h>
  52. #include <stdio.h>
  53. #include <stdlib.h>
  54. #include <stdarg.h>
  55. #include "node.h"
  56.  
  57. #include "y.tab.h"
  58.  
  59. #ifdef __SASC
  60. #define alloca malloc
  61. #else
  62. #include <alloca.h>
  63. #endif
  64.  
  65. #define PTR void *
  66.  
  67.  
  68.  
  69. int yyerror (const char *x);
  70. int yyparse (void);
  71. int yylex   (void);
  72. static void __yy_bcopy(char *, char *, int);
  73.  
  74. int errors = 0;
  75. extern int   lineno;
  76. extern char *filename;
  77. #define errorout(text) fprintf (stderr, "`%s',%d: %s\n", filename, lineno, text, ++errors)
  78.  
  79.  
  80. #ifndef YYLTYPE
  81. typedef
  82.   struct yyltype
  83.     {
  84.       int timestamp;
  85.       int first_line;
  86.       int first_column;
  87.       int last_line;
  88.       int last_column;
  89.       char *text;
  90.    }
  91.   yyltype;
  92.  
  93. #define YYLTYPE yyltype
  94. #endif
  95.  
  96. #ifndef YYSTYPE
  97. #define YYSTYPE int
  98. #endif
  99. #include <stdio.h>
  100.  
  101. #ifndef __cplusplus
  102. #ifndef __STDC__
  103. #define const
  104. #endif
  105. #endif
  106.  
  107.  
  108.  
  109. #define    YYFINAL        50
  110. #define    YYFLAG        -32768
  111. #define    YYNTBASE    31
  112.  
  113. #define YYTRANSLATE(x) ((unsigned)(x) <= 285 ? yytranslate[x] : 42)
  114.  
  115. static const char yytranslate[] = {     0,
  116.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  117.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  118.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  119.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  120.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  121.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  122.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  123.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  124.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  125.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  126.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  127.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  128.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  129.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  130.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  131.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  132.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  133.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  134.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  135.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  136.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  137.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  138.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  139.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  140.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  141.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  142.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  143.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  144.     26,    27,    28,    29,    30
  145. };
  146.  
  147. #if YYDEBUG != 0
  148. static const short yyprhs[] = {     0,
  149.      0,     4,     5,     6,     9,    12,    14,    16,    18,    20,
  150.     22,    24,    26,    28,    30,    31,    32,    38,    39,    44,
  151.     45,    49,    51,    55,    59,    63,    67,    70,    72,    74,
  152.     76,    78,    80
  153. };
  154.  
  155. static const short yyrhs[] = {    30,
  156.     32,    31,     0,     0,     0,    33,    32,     0,    34,    33,
  157.      0,    35,     0,    17,     0,    18,     0,    19,     0,    20,
  158.      0,    16,     0,    15,     0,    21,     0,    24,     0,     0,
  159.      0,    41,    36,     7,    37,    40,     0,     0,    41,    38,
  160.      9,    40,     0,     0,    41,    39,     8,     0,     8,     0,
  161.      3,    32,     5,     0,    10,    32,    11,     0,    12,    28,
  162.     13,     0,     4,    28,     6,     0,    41,     8,     0,    28,
  163.      0,    25,     0,    22,     0,    23,     0,    27,     0,    26,
  164.      0
  165. };
  166.  
  167. #endif
  168.  
  169. #if YYDEBUG != 0
  170. static const short yyrline[] = { 0,
  171.     91,    92,    95,    96,    99,   100,   103,   104,   105,   107,
  172.    108,   109,   110,   112,   115,   115,   115,   116,   116,   117,
  173.    117,   118,   122,   123,   124,   125,   126,   127,   131,   132,
  174.    133,   134,   135
  175. };
  176.  
  177. static const char * const yytname[] = {   "$","error","$illegal.","RBRA","EBRA",
  178. "RKET","EKET","ASS","SEMI","ADD","SBRA","SKET","SSBRA","SSKET","KOMMA","PROJECT",
  179. "GLOBAL","CONST","HIDDEN","INTERNAL","GENERIC","TEMPORARY","TYPES","NEEDED",
  180. "GENTYPE","DEFAULT","HELP","LABEL","VALUE","NEWFILE","BLOCKSTART","parts_list",
  181. "assignment_list","base_ass","type","assignment","@1","@2","@3","@4","body",
  182. "lval",""
  183. };
  184. #endif
  185.  
  186. static const short yyr1[] = {     0,
  187.     31,    31,    32,    32,    33,    33,    34,    34,    34,    34,
  188.     34,    34,    34,    34,    36,    37,    35,    38,    35,    39,
  189.     35,    35,    40,    40,    40,    40,    40,    40,    41,    41,
  190.     41,    41,    41
  191. };
  192.  
  193. static const short yyr2[] = {     0,
  194.      3,     0,     0,     2,     2,     1,     1,     1,     1,     1,
  195.      1,     1,     1,     1,     0,     0,     5,     0,     4,     0,
  196.      3,     1,     3,     3,     3,     3,     2,     1,     1,     1,
  197.      1,     1,     1
  198. };
  199.  
  200. static const short yydefact[] = {     2,
  201.      3,    22,    12,    11,     7,     8,     9,    10,    13,    30,
  202.     31,    14,    29,    33,    32,     2,     3,     0,     6,    15,
  203.      1,     4,     5,     0,     0,     0,    16,     0,    21,     0,
  204.      3,     0,     3,     0,    28,    19,     0,    17,     0,     0,
  205.      0,     0,    27,    23,    26,    24,    25,     0,     0,     0
  206. };
  207.  
  208. static const short yydefgoto[] = {    21,
  209.     16,    17,    18,    19,    24,    30,    25,    26,    36,    20
  210. };
  211.  
  212. static const short yypact[] = {   -26,
  213.     13,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  214. -32768,-32768,-32768,-32768,-32768,   -26,    13,    13,-32768,     2,
  215. -32768,-32768,-32768,    -1,     3,     0,-32768,    -3,-32768,    -3,
  216.     13,   -14,    13,   -13,-32768,-32768,     5,-32768,    12,    20,
  217.     16,    28,-32768,-32768,-32768,-32768,-32768,    42,    43,-32768
  218. };
  219.  
  220. static const short yypgoto[] = {    44,
  221.    -15,    27,-32768,-32768,-32768,-32768,-32768,-32768,    17,   -25
  222. };
  223.  
  224.  
  225. #define    YYLAST        47
  226.  
  227.  
  228. static const short yytable[] = {    31,
  229.     32,    22,    37,     1,    37,    27,    33,    29,    34,   -20,
  230.    -18,    28,    43,    40,    42,    39,    44,    41,    10,    11,
  231.      2,    13,    14,    15,    35,    45,    46,     3,     4,     5,
  232.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  233.     47,    49,    50,    48,    23,     0,    38
  234. };
  235.  
  236. static const short yycheck[] = {     3,
  237.      4,    17,    28,    30,    30,     7,    10,     8,    12,     8,
  238.      9,     9,     8,    28,    28,    31,     5,    33,    22,    23,
  239.      8,    25,    26,    27,    28,     6,    11,    15,    16,    17,
  240.     18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
  241.     13,     0,     0,     0,    18,    -1,    30
  242. };
  243. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  244. #line 3 "/usr/lib/bison.simple"
  245.  
  246. /* Skeleton output parser for bison,
  247.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  248.  
  249.    This program is free software; you can redistribute it and/or modify
  250.    it under the terms of the GNU General Public License as published by
  251.    the Free Software Foundation; either version 1, or (at your option)
  252.    any later version.
  253.  
  254.    This program is distributed in the hope that it will be useful,
  255.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  256.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  257.    GNU General Public License for more details.
  258.  
  259.    You should have received a copy of the GNU General Public License
  260.    along with this program; if not, write to the Free Software
  261.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  262.  
  263.  
  264. #ifndef alloca
  265. #ifdef __GNUC__
  266. #define alloca __builtin_alloca
  267. #else /* not GNU C.  */
  268. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
  269. #include <alloca.h>
  270. #else /* not sparc */
  271. #if defined (MSDOS) && !defined (__TURBOC__)
  272. #include <malloc.h>
  273. #else /* not MSDOS, or __TURBOC__ */
  274. #if defined(_AIX)
  275. #include <malloc.h>
  276.  #pragma alloca
  277. #else /* not MSDOS, __TURBOC__, or _AIX */
  278. #ifdef __hpux
  279. #ifdef __cplusplus
  280. extern "C" {
  281. void *alloca (unsigned int);
  282. };
  283. #else /* not __cplusplus */
  284. void *alloca ();
  285. #endif /* not __cplusplus */
  286. #endif /* __hpux */
  287. #endif /* not _AIX */
  288. #endif /* not MSDOS, or __TURBOC__ */
  289. #endif /* not sparc.  */
  290. #endif /* not GNU C.  */
  291. #endif /* alloca not defined.  */
  292.  
  293. /* This is the parser code that is written into each bison parser
  294.   when the %semantic_parser declaration is not specified in the grammar.
  295.   It was written by Richard Stallman by simplifying the hairy parser
  296.   used when %semantic_parser is specified.  */
  297.  
  298. /* Note: there must be only one dollar sign in this file.
  299.    It is replaced by the list of actions, each action
  300.    as one case of the switch.  */
  301.  
  302. #define yyerrok        (yyerrstatus = 0)
  303. #define yyclearin    (yychar = YYEMPTY)
  304. #define YYEMPTY        -2
  305. #define YYEOF        0
  306. #define YYACCEPT    return(0)
  307. #define YYABORT     return(1)
  308. #define YYERROR        goto yyerrlab1
  309. /* Like YYERROR except do call yyerror.
  310.    This remains here temporarily to ease the
  311.    transition to the new meaning of YYERROR, for GCC.
  312.    Once GCC version 2 has supplanted version 1, this can go.  */
  313. #define YYFAIL        goto yyerrlab
  314. #define YYRECOVERING()  (!!yyerrstatus)
  315. #define YYBACKUP(token, value) \
  316. do                                \
  317.   if (yychar == YYEMPTY && yylen == 1)                \
  318.     { yychar = (token), yylval = (value);            \
  319.       yychar1 = YYTRANSLATE (yychar);                \
  320.       YYPOPSTACK;                        \
  321.       goto yybackup;                        \
  322.     }                                \
  323.   else                                \
  324.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  325. while (0)
  326.  
  327. #define YYTERROR    1
  328. #define YYERRCODE    256
  329.  
  330. #ifndef YYPURE
  331. #define YYLEX        yylex()
  332. #endif
  333.  
  334. #ifdef YYPURE
  335. #ifdef YYLSP_NEEDED
  336. #define YYLEX        yylex(&yylval, &yylloc)
  337. #else
  338. #define YYLEX        yylex(&yylval)
  339. #endif
  340. #endif
  341.  
  342. /* If nonreentrant, generate the variables here */
  343.  
  344. #ifndef YYPURE
  345.  
  346. int    yychar;            /*  the lookahead symbol        */
  347. YYSTYPE    yylval;            /*  the semantic value of the        */
  348.                 /*  lookahead symbol            */
  349.  
  350. #ifdef YYLSP_NEEDED
  351. YYLTYPE yylloc;            /*  location data for the lookahead    */
  352.                 /*  symbol                */
  353. #endif
  354.  
  355. int yynerrs;            /*  number of parse errors so far       */
  356. #endif  /* not YYPURE */
  357.  
  358. #if YYDEBUG != 0
  359. int yydebug;            /*  nonzero means print parse trace    */
  360. /* Since this is uninitialized, it does not stop multiple parsers
  361.    from coexisting.  */
  362. #endif
  363.  
  364. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  365.  
  366. #ifndef    YYINITDEPTH
  367. #define YYINITDEPTH 200
  368. #endif
  369.  
  370. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  371.     (effective only if the built-in stack extension method is used).  */
  372.  
  373. #if YYMAXDEPTH == 0
  374. #undef YYMAXDEPTH
  375. #endif
  376.  
  377. #ifndef YYMAXDEPTH
  378. #define YYMAXDEPTH 10000
  379. #endif
  380.  
  381. /* Prevent warning if -Wstrict-prototypes.  */
  382. #ifdef __GNUC__
  383. int yyparse (void);
  384. #endif
  385.  
  386. #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
  387. #define __yy_bcopy(FROM,TO,COUNT)    __builtin_memcpy(TO,FROM,COUNT)
  388. #else                /* not GNU C or C++ */
  389. #ifndef __cplusplus
  390.  
  391. /* This is the most reliable way to avoid incompatibilities
  392.    in available built-in functions on various systems.  */
  393. static void
  394. __yy_bcopy (from, to, count)
  395.      char *from;
  396.      char *to;
  397.      int count;
  398. {
  399.   register char *f = from;
  400.   register char *t = to;
  401.   register int i = count;
  402.  
  403.   while (i-- > 0)
  404.     *t++ = *f++;
  405. }
  406.  
  407. #else /* __cplusplus */
  408.  
  409. /* This is the most reliable way to avoid incompatibilities
  410.    in available built-in functions on various systems.  */
  411. static void
  412. __yy_bcopy (char *from, char *to, int count)
  413. {
  414.   register char *f = from;
  415.   register char *t = to;
  416.   register int i = count;
  417.  
  418.   while (i-- > 0)
  419.     *t++ = *f++;
  420. }
  421.  
  422. #endif
  423. #endif
  424.  
  425. #line 184 "/usr/lib/bison.simple"
  426. int
  427. yyparse()
  428. {
  429.   register int yystate;
  430.   register int yyn;
  431.   register short *yyssp;
  432.   register YYSTYPE *yyvsp;
  433.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  434.   int yychar1 = 0;        /*  lookahead token as an internal (translated) token number */
  435.  
  436.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  437.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  438.  
  439.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  440.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  441.  
  442. #ifdef YYLSP_NEEDED
  443.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  444.   YYLTYPE *yyls = yylsa;
  445.   YYLTYPE *yylsp;
  446.  
  447. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  448. #else
  449. #define YYPOPSTACK   (yyvsp--, yyssp--)
  450. #endif
  451.  
  452.   int yystacksize = YYINITDEPTH;
  453.  
  454. #ifdef YYPURE
  455.   int yychar;
  456.   YYSTYPE yylval;
  457.   int yynerrs;
  458. #ifdef YYLSP_NEEDED
  459.   YYLTYPE yylloc;
  460. #endif
  461. #endif
  462.  
  463.   YYSTYPE yyval;        /*  the variable used to return        */
  464.                 /*  semantic values from the action    */
  465.                 /*  routines                */
  466.  
  467.   int yylen;
  468.  
  469. #if YYDEBUG != 0
  470.   if (yydebug)
  471.     fprintf(stderr, "Starting parse\n");
  472. #endif
  473.  
  474.   yystate = 0;
  475.   yyerrstatus = 0;
  476.   yynerrs = 0;
  477.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  478.  
  479.   /* Initialize stack pointers.
  480.      Waste one element of value and location stack
  481.      so that they stay on the same level as the state stack.
  482.      The wasted elements are never initialized.  */
  483.  
  484.   yyssp = yyss - 1;
  485.   yyvsp = yyvs;
  486. #ifdef YYLSP_NEEDED
  487.   yylsp = yyls;
  488. #endif
  489.  
  490. /* Push a new state, which is found in  yystate  .  */
  491. /* In all cases, when you get here, the value and location stacks
  492.    have just been pushed. so pushing a state here evens the stacks.  */
  493. yynewstate:
  494.  
  495.   *++yyssp = yystate;
  496.  
  497.   if (yyssp >= yyss + yystacksize - 1)
  498.     {
  499.       /* Give user a chance to reallocate the stack */
  500.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  501.       YYSTYPE *yyvs1 = yyvs;
  502.       short *yyss1 = yyss;
  503. #ifdef YYLSP_NEEDED
  504.       YYLTYPE *yyls1 = yyls;
  505. #endif
  506.  
  507.       /* Get the current used size of the three stacks, in elements.  */
  508.       int size = yyssp - yyss + 1;
  509.  
  510. #ifdef yyoverflow
  511.       /* Each stack pointer address is followed by the size of
  512.      the data in use in that stack, in bytes.  */
  513. #ifdef YYLSP_NEEDED
  514.       /* This used to be a conditional around just the two extra args,
  515.      but that might be undefined if yyoverflow is a macro.  */
  516.       yyoverflow("parser stack overflow",
  517.          &yyss1, size * sizeof (*yyssp),
  518.          &yyvs1, size * sizeof (*yyvsp),
  519.          &yyls1, size * sizeof (*yylsp),
  520.          &yystacksize);
  521. #else
  522.       yyoverflow("parser stack overflow",
  523.          &yyss1, size * sizeof (*yyssp),
  524.          &yyvs1, size * sizeof (*yyvsp),
  525.          &yystacksize);
  526. #endif
  527.  
  528.       yyss = yyss1; yyvs = yyvs1;
  529. #ifdef YYLSP_NEEDED
  530.       yyls = yyls1;
  531. #endif
  532. #else /* no yyoverflow */
  533.       /* Extend the stack our own way.  */
  534.       if (yystacksize >= YYMAXDEPTH)
  535.     {
  536.       yyerror("parser stack overflow");
  537.       return 2;
  538.     }
  539.       yystacksize *= 2;
  540.       if (yystacksize > YYMAXDEPTH)
  541.     yystacksize = YYMAXDEPTH;
  542.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  543.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  544.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  545.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  546. #ifdef YYLSP_NEEDED
  547.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  548.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  549. #endif
  550. #endif /* no yyoverflow */
  551.  
  552.       yyssp = yyss + size - 1;
  553.       yyvsp = yyvs + size - 1;
  554. #ifdef YYLSP_NEEDED
  555.       yylsp = yyls + size - 1;
  556. #endif
  557.  
  558. #if YYDEBUG != 0
  559.       if (yydebug)
  560.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  561. #endif
  562.  
  563.       if (yyssp >= yyss + yystacksize - 1)
  564.     YYABORT;
  565.     }
  566.  
  567. #if YYDEBUG != 0
  568.   if (yydebug)
  569.     fprintf(stderr, "Entering state %d\n", yystate);
  570. #endif
  571.  
  572.   goto yybackup;
  573.  yybackup:
  574.  
  575. /* Do appropriate processing given the current state.  */
  576. /* Read a lookahead token if we need one and don't already have one.  */
  577. /* yyresume: */
  578.  
  579.   /* First try to decide what to do without reference to lookahead token.  */
  580.  
  581.   yyn = yypact[yystate];
  582.   if (yyn == YYFLAG)
  583.     goto yydefault;
  584.  
  585.   /* Not known => get a lookahead token if don't already have one.  */
  586.  
  587.   /* yychar is either YYEMPTY or YYEOF
  588.      or a valid token in external form.  */
  589.  
  590.   if (yychar == YYEMPTY)
  591.     {
  592. #if YYDEBUG != 0
  593.       if (yydebug)
  594.     fprintf(stderr, "Reading a token: ");
  595. #endif
  596.       yychar = YYLEX;
  597.     }
  598.  
  599.   /* Convert token to internal form (in yychar1) for indexing tables with */
  600.  
  601.   if (yychar <= 0)        /* This means end of input. */
  602.     {
  603.       yychar1 = 0;
  604.       yychar = YYEOF;        /* Don't call YYLEX any more */
  605.  
  606. #if YYDEBUG != 0
  607.       if (yydebug)
  608.     fprintf(stderr, "Now at end of input.\n");
  609. #endif
  610.     }
  611.   else
  612.     {
  613.       yychar1 = YYTRANSLATE(yychar);
  614.  
  615. #if YYDEBUG != 0
  616.       if (yydebug)
  617.     {
  618.       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  619.       /* Give the individual parser a way to print the precise meaning
  620.          of a token, for further debugging info.  */
  621. #ifdef YYPRINT
  622.       YYPRINT (stderr, yychar, yylval);
  623. #endif
  624.       fprintf (stderr, ")\n");
  625.     }
  626. #endif
  627.     }
  628.  
  629.   yyn += yychar1;
  630.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  631.     goto yydefault;
  632.  
  633.   yyn = yytable[yyn];
  634.  
  635.   /* yyn is what to do for this token type in this state.
  636.      Negative => reduce, -yyn is rule number.
  637.      Positive => shift, yyn is new state.
  638.        New state is final state => don't bother to shift,
  639.        just return success.
  640.      0, or most negative number => error.  */
  641.  
  642.   if (yyn < 0)
  643.     {
  644.       if (yyn == YYFLAG)
  645.     goto yyerrlab;
  646.       yyn = -yyn;
  647.       goto yyreduce;
  648.     }
  649.   else if (yyn == 0)
  650.     goto yyerrlab;
  651.  
  652.   if (yyn == YYFINAL)
  653.     YYACCEPT;
  654.  
  655.   /* Shift the lookahead token.  */
  656.  
  657. #if YYDEBUG != 0
  658.   if (yydebug)
  659.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  660. #endif
  661.  
  662.   /* Discard the token being shifted unless it is eof.  */
  663.   if (yychar != YYEOF)
  664.     yychar = YYEMPTY;
  665.  
  666.   *++yyvsp = yylval;
  667. #ifdef YYLSP_NEEDED
  668.   *++yylsp = yylloc;
  669. #endif
  670.  
  671.   /* count tokens shifted since error; after three, turn off error status.  */
  672.   if (yyerrstatus) yyerrstatus--;
  673.  
  674.   yystate = yyn;
  675.   goto yynewstate;
  676.  
  677. /* Do the default action for the current state.  */
  678. yydefault:
  679.  
  680.   yyn = yydefact[yystate];
  681.   if (yyn == 0)
  682.     goto yyerrlab;
  683.  
  684. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  685. yyreduce:
  686.   yylen = yyr2[yyn];
  687.   if (yylen > 0)
  688.     yyval = yyvsp[1-yylen]; /* implement default value of the action */
  689.  
  690. #if YYDEBUG != 0
  691.   if (yydebug)
  692.     {
  693.       int i;
  694.  
  695.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  696.            yyn, yyrline[yyn]);
  697.  
  698.       /* Print the symbols being reduced, and their result.  */
  699.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  700.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  701.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  702.     }
  703. #endif
  704.  
  705.  
  706.   switch (yyn) {
  707.  
  708. case 7:
  709. #line 103 "yacc.y"
  710. { NODE_access (CA_CONST);   ;
  711.     break;}
  712. case 8:
  713. #line 104 "yacc.y"
  714. { NODE_access (CA_HIDDEN);  ;
  715.     break;}
  716. case 9:
  717. #line 105 "yacc.y"
  718. { NODE_access (CA_INTERNAL);;
  719.     break;}
  720. case 10:
  721. #line 107 "yacc.y"
  722. { NODE_spc    (CS_GENERIC);   ;
  723.     break;}
  724. case 11:
  725. #line 108 "yacc.y"
  726. { NODE_spc    (CS_GLOBAL);    ;
  727.     break;}
  728. case 12:
  729. #line 109 "yacc.y"
  730. { NODE_spc    (CS_PROJECT);   ;
  731.     break;}
  732. case 13:
  733. #line 110 "yacc.y"
  734. { NODE_spc    (CS_TEMPORARY); ;
  735.     break;}
  736. case 14:
  737. #line 112 "yacc.y"
  738. { NODE_type ((PTR)yyvsp[0]);      ;
  739.     break;}
  740. case 15:
  741. #line 115 "yacc.y"
  742. {NODE_PUSH((PTR)yyvsp[0], 1);;
  743.     break;}
  744. case 16:
  745. #line 115 "yacc.y"
  746. {NODE_CLEAR();;
  747.     break;}
  748. case 17:
  749. #line 115 "yacc.y"
  750. { NODE_POP(); ;
  751.     break;}
  752. case 18:
  753. #line 116 "yacc.y"
  754. {NODE_PUSH((PTR)yyvsp[0], 1);;
  755.     break;}
  756. case 19:
  757. #line 116 "yacc.y"
  758. { NODE_POP(); ;
  759.     break;}
  760. case 20:
  761. #line 117 "yacc.y"
  762. {NODE_PUSH((PTR)yyvsp[0], 1);;
  763.     break;}
  764. case 21:
  765. #line 117 "yacc.y"
  766. { NODE_POP(); ;
  767.     break;}
  768. case 25:
  769. #line 124 "yacc.y"
  770. { NODE_TEXT((PTR)yyvsp[-1]); ;
  771.     break;}
  772. case 26:
  773. #line 125 "yacc.y"
  774. { NODE_TEXT((PTR)yyvsp[-1]); ;
  775.     break;}
  776. case 27:
  777. #line 126 "yacc.y"
  778. { NODE_TEXT((PTR)yyvsp[-1]); ;
  779.     break;}
  780. case 28:
  781. #line 127 "yacc.y"
  782. { NODE_TEXT((PTR)yyvsp[0]); ;
  783.     break;}
  784. case 29:
  785. #line 131 "yacc.y"
  786. { yyval = 0;  ;
  787.     break;}
  788. case 30:
  789. #line 132 "yacc.y"
  790. { yyval = 1;  ;
  791.     break;}
  792. case 31:
  793. #line 133 "yacc.y"
  794. { yyval = 2;  ;
  795.     break;}
  796. case 32:
  797. #line 134 "yacc.y"
  798. { yyval = yyvsp[0]; ;
  799.     break;}
  800. case 33:
  801. #line 135 "yacc.y"
  802. { yyval = yyvsp[0]; ;
  803.     break;}
  804. }
  805.    /* the action file gets copied in in place of this dollarsign */
  806. #line 465 "/usr/lib/bison.simple"
  807.  
  808.   yyvsp -= yylen;
  809.   yyssp -= yylen;
  810. #ifdef YYLSP_NEEDED
  811.   yylsp -= yylen;
  812. #endif
  813.  
  814. #if YYDEBUG != 0
  815.   if (yydebug)
  816.     {
  817.       short *ssp1 = yyss - 1;
  818.       fprintf (stderr, "state stack now");
  819.       while (ssp1 != yyssp)
  820.     fprintf (stderr, " %d", *++ssp1);
  821.       fprintf (stderr, "\n");
  822.     }
  823. #endif
  824.  
  825.   *++yyvsp = yyval;
  826.  
  827. #ifdef YYLSP_NEEDED
  828.   yylsp++;
  829.   if (yylen == 0)
  830.     {
  831.       yylsp->first_line = yylloc.first_line;
  832.       yylsp->first_column = yylloc.first_column;
  833.       yylsp->last_line = (yylsp-1)->last_line;
  834.       yylsp->last_column = (yylsp-1)->last_column;
  835.       yylsp->text = 0;
  836.     }
  837.   else
  838.     {
  839.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  840.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  841.     }
  842. #endif
  843.  
  844.   /* Now "shift" the result of the reduction.
  845.      Determine what state that goes to,
  846.      based on the state we popped back to
  847.      and the rule number reduced by.  */
  848.  
  849.   yyn = yyr1[yyn];
  850.  
  851.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  852.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  853.     yystate = yytable[yystate];
  854.   else
  855.     yystate = yydefgoto[yyn - YYNTBASE];
  856.  
  857.   goto yynewstate;
  858.  
  859. yyerrlab:   /* here on detecting error */
  860.  
  861.   if (! yyerrstatus)
  862.     /* If not already recovering from an error, report this error.  */
  863.     {
  864.       ++yynerrs;
  865.  
  866. #ifdef YYERROR_VERBOSE
  867.       yyn = yypact[yystate];
  868.  
  869.       if (yyn > YYFLAG && yyn < YYLAST)
  870.     {
  871.       int size = 0;
  872.       char *msg;
  873.       int x, count;
  874.  
  875.       count = 0;
  876.       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
  877.       for (x = (yyn < 0 ? -yyn : 0);
  878.            x < (sizeof(yytname) / sizeof(char *)); x++)
  879.         if (yycheck[x + yyn] == x)
  880.           size += strlen(yytname[x]) + 15, count++;
  881.       msg = (char *) malloc(size + 15);
  882.       if (msg != 0)
  883.         {
  884.           strcpy(msg, "parse error");
  885.  
  886.           if (count < 5)
  887.         {
  888.           count = 0;
  889.           for (x = (yyn < 0 ? -yyn : 0);
  890.                x < (sizeof(yytname) / sizeof(char *)); x++)
  891.             if (yycheck[x + yyn] == x)
  892.               {
  893.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  894.             strcat(msg, yytname[x]);
  895.             strcat(msg, "'");
  896.             count++;
  897.               }
  898.         }
  899.           yyerror(msg);
  900.           free(msg);
  901.         }
  902.       else
  903.         yyerror ("parse error; also virtual memory exceeded");
  904.     }
  905.       else
  906. #endif /* YYERROR_VERBOSE */
  907.     yyerror("parse error");
  908.     }
  909.  
  910.   goto yyerrlab1;
  911. yyerrlab1:   /* here on error raised explicitly by an action */
  912.  
  913.   if (yyerrstatus == 3)
  914.     {
  915.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  916.  
  917.       /* return failure if at end of input */
  918.       if (yychar == YYEOF)
  919.     YYABORT;
  920.  
  921. #if YYDEBUG != 0
  922.       if (yydebug)
  923.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  924. #endif
  925.  
  926.       yychar = YYEMPTY;
  927.     }
  928.  
  929.   /* Else will try to reuse lookahead token
  930.      after shifting the error token.  */
  931.  
  932.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  933.  
  934.   goto yyerrhandle;
  935.  
  936. yyerrdefault:  /* current state does not do anything special for the error token. */
  937.  
  938. #if 0
  939.   /* This is wrong; only states that explicitly want error tokens
  940.      should shift them.  */
  941.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  942.   if (yyn) goto yydefault;
  943. #endif
  944.  
  945. yyerrpop:   /* pop the current state because it cannot handle the error token */
  946.  
  947.   if (yyssp == yyss) YYABORT;
  948.   yyvsp--;
  949.   yystate = *--yyssp;
  950. #ifdef YYLSP_NEEDED
  951.   yylsp--;
  952. #endif
  953.  
  954. #if YYDEBUG != 0
  955.   if (yydebug)
  956.     {
  957.       short *ssp1 = yyss - 1;
  958.       fprintf (stderr, "Error: state stack now");
  959.       while (ssp1 != yyssp)
  960.     fprintf (stderr, " %d", *++ssp1);
  961.       fprintf (stderr, "\n");
  962.     }
  963. #endif
  964.  
  965. yyerrhandle:
  966.  
  967.   yyn = yypact[yystate];
  968.   if (yyn == YYFLAG)
  969.     goto yyerrdefault;
  970.  
  971.   yyn += YYTERROR;
  972.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  973.     goto yyerrdefault;
  974.  
  975.   yyn = yytable[yyn];
  976.   if (yyn < 0)
  977.     {
  978.       if (yyn == YYFLAG)
  979.     goto yyerrpop;
  980.       yyn = -yyn;
  981.       goto yyreduce;
  982.     }
  983.   else if (yyn == 0)
  984.     goto yyerrpop;
  985.  
  986.   if (yyn == YYFINAL)
  987.     YYACCEPT;
  988.  
  989. #if YYDEBUG != 0
  990.   if (yydebug)
  991.     fprintf(stderr, "Shifting error token, ");
  992. #endif
  993.  
  994.   *++yyvsp = yylval;
  995. #ifdef YYLSP_NEEDED
  996.   *++yylsp = yylloc;
  997. #endif
  998.  
  999.   yystate = yyn;
  1000.   goto yynewstate;
  1001. }
  1002. #line 139 "yacc.y"
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009. int yyerror (const char *x)
  1010. {
  1011.     extern int lineno;
  1012.     extern void NODE_TREE(void *, void *);
  1013.  
  1014.     fprintf (stderr, "%s\n (file `%s', line %ld)\n", x, filename, lineno);
  1015.     {
  1016.     char *comment = NULL;
  1017.     switch (yychar) {
  1018. #define tk(x)    case x: comment =  #x; break;
  1019. #define tkl(x,n) case x: comment =   n; break;
  1020.     tk( EOF )
  1021.     tkl( RBRA, "openbracket" )
  1022.     tkl( EBRA, "openbracket" )
  1023.     tkl( RKET, "closebracket" )
  1024.     tkl( EKET, "closebracket" )
  1025.     tkl( ASS,  "assignmentoperator" )
  1026.     tkl( SEMI, "semicolon" )
  1027.     tkl( ADD,  "addoperator" )
  1028.     tk( PROJECT )
  1029.     tk( GLOBAL )
  1030.     tk( CONST )
  1031.     tk( HIDDEN )
  1032.     tk( INTERNAL )
  1033.     tk( GENERIC )
  1034.     tk( TEMPORARY )
  1035.     tk( GENTYPE )
  1036.     tk( TYPES )
  1037.     tk( NEEDED )
  1038.     tk( DEFAULT )
  1039.     tk( LABEL )
  1040.     tk( VALUE )
  1041.     tk( NEWFILE )
  1042.     tk( BLOCKSTART )
  1043.     } /* switch */
  1044.     if (comment)
  1045.         printf ("probably unexpected %s %s\n", comment, (yychar == LABEL)? yylval: "");
  1046.     }
  1047.     NODE_TREE(NULL, NULL);
  1048.     // exit (-1);
  1049.     return 0;
  1050. } /* yyerror */
  1051.  
  1052.